import { ref } from 'vue'
import request from '@/utils/request'
import { defineStore } from 'pinia'

// 商品分类函数
export const useCategoryStore = defineStore('category', () => { 
    const categoryList = ref({})

    // 获取商品分类
    const getCategory = async () => {
        let result = await request.get('/commodity/categoryList')
        categoryList.value = result.data
    }

    return {
        categoryList,
        getCategory
    }
}, {
    persist: true,
})